package com.atjava.nebula.weixin.security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter;

import com.atjava.nebula.weixin.ssl.WeixinConst;

public class WeixinAuthenticationFilter extends RequestHeaderAuthenticationFilter{

	@Override
	protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
		
		HttpSession session = request.getSession();
		Object weixinLogin = session.getAttribute(WeixinConst.SECURITY_SESSKEY_WEIXIN_LOGIN);
		if(weixinLogin == null){
			return null;
		}
		return request.getParameter(WeixinConst.SECURITY_REQKEY_WEIXIN_USER);
	}
	

}
